import { createI18n } from 'vue-i18n'
import type { SupportedLocale } from '../types/i18n'
import en from '@/locales/en.json'
import ja from '@/locales/ja.json'

// 类型安全的消息定义
const messages = {
  en: en,
  ja: ja,
}

// 创建类型安全的i18n实例
export const i18n = createI18n({
  locale: 'en' as SupportedLocale,
  fallbackLocale: 'en' as SupportedLocale,
  messages,
  legacy: false,
})

export default i18n
export const $t = i18n.global.t
